#include <iostream>
#include <memory>
#include "udpserver.hpp"
#include "dict.hpp"

void Usage(std::string proc)
{
    std::cout << "usage:" << proc << ' ' << "port" << std::endl;
}

int main(int argc, char *argv[])
{
    EnableScreen();
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(usage_error);
    }
    //翻译模块
    Dict dict;

    //网络模块
    uint16_t port = std::atoi(argv[1]);
    std::unique_ptr<UdpServer> usr = std::make_unique<UdpServer>(port,std::bind(&Dict::translate,&dict,std::placeholders::_1));

    usr->init();
    usr->start();
    return 0;
}